//
//  AppDelegate.m
//  CloudMD
//
//  Created by apple on 16/2/17.
//  Copyright (c) 2016年 HuaZhengInfo. All rights reserved.
//

#import "AppDelegate.h"
#import "GDBaseTabBarController.h"
#import "IQKeyboardManager.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    [[IQKeyboardManager sharedManager] setEnable:YES];//控制整个功能是否启用。
    [[IQKeyboardManager sharedManager] setEnableAutoToolbar:YES];//控制是否显示键盘上的工具条
    [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;//控制点击背景是否收起键盘
    [IQKeyboardManager sharedManager].canAdjustTextView = YES;
    [IQKeyboardManager sharedManager].enableAutoToolbar = YES;//是否显示工具条
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    [self gotoMianView];
    
    [self requestSERVICEData];
    
    return YES;
}


#pragma mark -- 请求订单类型数据
- (void)requestSERVICEData{
    
    
    NSArray * keyArray = @[@"MODULE",@"USER_ID",@"USER_CODE",@"GUID",@"PARAMETER1"];
    NSArray * valueArray = @[@"SERVICE",@"1219",@"00086554",@"",@""];
    NSDictionary * dict = [NSDictionary dictionaryWithObjects:valueArray forKeys:keyArray];
    NSString * urlStr = [NSString stringWithFormat:@"%@%@",Base_URL,GetWGH_URL];
    
    HZNetWorkAgent *agent = [HZNetWorkAgent shareInstance];
    [agent requestUrl:urlStr param:dict baseUrl:@"" withRequestMethod:HZRequestMethodPost withCompletionWithSuccess:^(HZBaseRequest *http, BOOL isSuccess) {
        NSMutableArray * array = [http.returnArray mutableCopy];
        NSUserDefaults *cateDefaults = [NSUserDefaults standardUserDefaults];
        [cateDefaults setObject:array forKey:@"cateDefaults"];
    } withTag:101];
}

- (void)gotoMianView{
    
    GDBaseTabBarController * baseTarBar = [[GDBaseTabBarController alloc] init];
    [baseTarBar addViewControllerWithName:@"GrabOrderViewController" title:@"在线抢单" image:@"label01" selectedImage:@"hover_label01"];
    [baseTarBar addViewControllerWithName:@"PlaceOrderViewController" title:@"在线下单" image:@"label02" selectedImage:@"hover_label02"];
    [baseTarBar addViewControllerWithName:@"ExecuteOrderViewController" title:@"订单执行" image:@"label03" selectedImage:@"hover_label03"];
    [baseTarBar addViewControllerWithName:@"OrderAssignViewController" title:@"订单指派" image:@"label03" selectedImage:@"hover_label03"];
    [baseTarBar addViewControllerWithName:@"CheckOrderViewController" title:@"申报审核" image:@"label04" selectedImage:@"hover_label04"];
    [baseTarBar addViewControllerWithName:@"IndepentDeclareViewController" title:@"自主申报" image:@"label04" selectedImage:@"hover_label04"];
    self.window.rootViewController = baseTarBar;
    
    
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
